package com.swz.dcrm.adpter;

import android.content.Context;
import android.view.View;

import com.swz.dcrm.R;
import com.swz.dcrm.base.ViewHolder;
import com.swz.dcrm.model.BoutiqueGroup;

import java.util.List;
import java.util.Map;

public class BoutiqueGroupAdapter extends CustomAdapter<BoutiqueGroup> {



    public BoutiqueGroupAdapter(Context context, List<BoutiqueGroup> datas) {
        super(context, R.layout.item_boutique_group, datas);
    }

    @Override
    protected void convert(ViewHolder holder, BoutiqueGroup boutiqueGroup, int position) {
            holder.setText(R.id.tv_boutique_group_name,boutiqueGroup.getBoutiqueGroupName());
            if(position==getCurrentClickPosition()){
                holder.getView(R.id.tv_boutique_group_name).setEnabled(false);
                holder.getView(R.id.triangle).setVisibility(View.VISIBLE);
            }else {
                holder.getView(R.id.tv_boutique_group_name).setEnabled(true);
                holder.getView(R.id.triangle).setVisibility(View.GONE);
            }
            holder.itemView.setOnClickListener(v -> {
                setCurrentClickPosition(position);
                notifyDataSetChanged();
                if(onClickListener!=null){
                    onClickListener.onItemClick(boutiqueGroup);
                }
            });
    }
}
